package cn.neusoft.edu.his.demo.controller;


import cn.neusoft.edu.his.demo.common.Result;
import cn.neusoft.edu.his.demo.mapper.DoctorWorkMapper;

import cn.neusoft.edu.his.demo.po.DoctorWork;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@Api("DoctorWorkControlloer相关的api")
@RestController
public class DoctorWorkController {
   @Autowired
    DoctorWorkMapper doctorWorkMapper;
    @RequestMapping("/getDoctorWorkById")
    public Result getDoctorWorkById(DoctorWork doctorWork){
        QueryWrapper<DoctorWork> Wrapper = new QueryWrapper<>();
        Wrapper.eq("doc_id",doctorWork.getDocId())
                .orderByDesc("day");
        List<DoctorWork> doctorWorks = doctorWorkMapper.selectList(Wrapper);
        return Result.ok(doctorWorks);
    }
}
